package t1;

import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;

public class KarstenLoader {

	/**
	 * @param args
	 * @throws MalformedURLException 
	 * @throws ClassNotFoundException 
	 * @throws IllegalAccessException 
	 * @throws InstantiationException 
	 */
	public static void main(String[] args) throws MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException {
//	byte[] bytecode = new byte[]{0};
	
	KarstenLoader loader = new KarstenLoader();
	
	URLClassLoader urlClassLoader = new URLClassLoader(new URL[]{new URL("file://bin/t1/Echo.class")});
	Class<?> autoClass =urlClassLoader.loadClass("t1.Echo");
	
	ClassLoader classLoader = autoClass.getClassLoader();
	
	System.out.println(classLoader);
	System.out.println(urlClassLoader);
	
	Runnable r = (Runnable) (new URLClassLoader(new URL[]{new URL("file://bin/t1/HelloWorld.class")})).loadClass("t1.HelloWorld").newInstance();
	r.run();
//	loader = (Echo) autoClass.newInstance();

	}
}
